Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

メモリーリークの改善 #125

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from
Open

Conversation

voluntas
Copy link
Member

@voluntas voluntas commented Jan 13, 2025

This pull request includes several changes to the e2e-test.yml workflow configuration and the Sora and SoraConnection classes to improve memory management and simplify the codebase. The most important changes include updates to the workflow triggers, modifications to the Sora and SoraConnection constructors, and removal of unused code.

Workflow configuration updates:

Codebase simplification and memory management improvements:

  • src/sora.cpp: Modified Sora::CreateConnection to pass factory_ to SoraConnection and removed the management of weak_connections_. [1] [2]
  • src/sora.h: Changed factory_ to a shared_ptr and removed weak_connections_ from the Sora class. [1] [2]
  • src/sora_connection.cpp: Updated SoraConnection constructor to accept a shared_ptr<SoraFactory> and set conn_ and factory_ to nullptr in the destructor. [1] [2]
  • src/sora_connection.h: Added factory_ as a member of SoraConnection and updated the constructor to accept it. [1] [2] [3]
  • src/sora_sdk_ext.cpp: Removed sora_tp_traverse and sora_tp_clear functions and their associated type slots, simplifying the Sora class definition. [1] [2]

@voluntas voluntas changed the title Feature/fix memoryleak3 メモリーリークの改善 Jan 13, 2025
@voluntas voluntas requested a review from melpon January 13, 2025 14:39
@tnoho
Copy link
Contributor

tnoho commented Jan 13, 2025

なんか英語で説明書かれてる。。。まぁ、別に間違ったことは書いてないのですが日本語で。

Sora から weak_connections_ とその関連コードは取り除きました。Sora 破棄前に SoraConnection をガベージコレクタに巡回させる役割を担っていたかと思いますが、結局インスタンスが破棄できなくなってしまいインスタンスリークを引き起こしていたので、取り除くこととしました。

しかし、それでは SoraFactory が SoraSignaling より先に破棄されてしまってセグメンテーション違反を引き起こす問題が解決しないため、 SoraFactory を unique_ptr から shared_ptr に変えて SoraConnection からも参照させることで維持することでセグメンテーション違反を発生させないようにしました。

結局は以前、まぁこの方法なら起きなくはなるよね。と言っていた奥の手になります。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants